﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace zhihu {
    class AnswerInfo {
        /// <summary>
        /// 赞同次数
        /// </summary>
        public int Vote { set; get; }
        /// <summary>
        /// 回答长度
        /// </summary>
        public int AnswerLength { set; get; }
        /// <summary>
        /// 得分
        /// </summary>
        public double Score { set; get; }
        /// <summary>
        /// 回答的详细内容,保存HTML,因为内容会有图片或超链接
        /// </summary>
        public string AnswerHtml { set; get; }
        /// <summary>
        /// 按分数排序算法 倒序
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static int CompareByScore(AnswerInfo x, AnswerInfo y) {
            if (x.Score == y.Score) {
                return 0;
            }
            else {
                return x.Score < y.Score ? 1 : -1;
            }
        }
    }
}
